package com.start.shop.api.vo.order;

import java.util.ArrayList;
import java.util.List;

import com.github.pagehelper.PageInfo;
import com.start.shop.common.constant.PageVo;
import com.start.shop.modules.repository.entity.Order;

import lombok.Data;

@Data
public class OrderQueryVo {
	private List<OrderVo> orderList;
	private PageVo page;

	public static OrderQueryVo setData(PageInfo<Order> orderPage) {
		OrderQueryVo orderQueryVo = new OrderQueryVo();
		
		List<OrderVo> orderVoList = new ArrayList<OrderVo>();
		for (int i = 0; i < orderPage.getList().size(); i++) {
			OrderVo orderVo = OrderVo.setData(orderPage.getList().get(i));
			orderVoList.add(orderVo);
		}
		orderQueryVo.setOrderList(orderVoList);
		orderQueryVo.setPage(PageVo.setData(orderPage));
		
		return orderQueryVo;
	}
}
